package com.cbwl.eoas.cms.model.eoas;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.springframework.util.StringUtils;

import com.cbwl.eoas.common.base.CommonBean;
import com.cbwl.eoas.common.cache.redis.RedisCache;
import com.cbwl.eoas.common.cache.redis.RedisKeyPrefix;
import com.cbwl.eoas.common.util.SpringContextUtil;


/**
 * 
 * <p>[描述信息：说明类的基本功能]</p>
 *
 * @author 虞云波 - yuyunbo@3856.cc
 * @version 1.0 Created on 2017年10月20日 下午5:21:57
 */
public class AppVersionDTO extends CommonBean {

	
	private static final long serialVersionUID = -389718951879418592L;
	
	private java.lang.Long id;
	private java.lang.String versionNo;
	//版本编号
	private String versionCode;
	private java.lang.String versionContent;
	private java.lang.String versionUrl;
	private Integer coercionIs;
	private java.lang.String versionStatus;
	
	private java.lang.Long creater;
	
	private java.util.Date gmtCreate;
	
	private java.lang.Long modifier;
	
	private java.util.Date gmtModified;
	
	private String versionType;
	
	private String appId;
	
	private Long timeStamp;
	
	private String versionStatusName;
	
	private String versionTypeName;
	
	private String param;
	
	
	public void setId(java.lang.Long value) {
		this.id = value;
	}
	
	public java.lang.Long getId() {
		return this.id;
	}
	
	public void setVersionNo(java.lang.String value) {
		this.versionNo = value;
	}
	
	public java.lang.String getVersionNo() {
		return this.versionNo;
	}
	
	public void setVersionContent(java.lang.String value) {
		this.versionContent = value;
	}
	
	public java.lang.String getVersionContent() {
		return this.versionContent;
	}
	
	public void setVersionUrl(java.lang.String value) {
		this.versionUrl = value;
	}
	
	public java.lang.String getVersionUrl() {
		return this.versionUrl;
	}
	
	public Integer getCoercionIs() {
		return coercionIs;
	}
	
	public void setCoercionIs(Integer coercionIs) {
		this.coercionIs = coercionIs;
	}

	public void setVersionStatus(java.lang.String value) {
		this.versionStatus = value;
		if (!StringUtils.isEmpty(value)) {
			RedisCache<String, String> redisCache = (RedisCache<String, String>) SpringContextUtil.getBean("redisCache");
			String redisValue =  redisCache.getStr(RedisKeyPrefix.DIC_PREFIX+value);
			if (!StringUtils.isEmpty(redisValue)) {
				this.versionStatusName = redisValue;
			}
		}
	}
	
	public java.lang.String getVersionStatus() {
		return this.versionStatus;
	}
	
	public String getVersionTypeName() {
		return versionTypeName;
	}

	
	public void setVersionTypeName(String versionTypeName) {
		this.versionTypeName = versionTypeName;
	}

	public void setCreater(java.lang.Long value) {
		this.creater = value;
	}
	
	public java.lang.Long getCreater() {
		return this.creater;
	}
	
	public void setGmtCreate(java.util.Date value) {
		this.gmtCreate = value;
	}
	
	public java.util.Date getGmtCreate() {
		return this.gmtCreate;
	}
	
	public void setModifier(java.lang.Long value) {
		this.modifier = value;
	}
	
	public java.lang.Long getModifier() {
		return this.modifier;
	}
	
	public void setGmtModified(java.util.Date value) {
		this.gmtModified = value;
	}
	
	public java.util.Date getGmtModified() {
		return this.gmtModified;
	}
	
	public String getVersionType() {
		return versionType;
	}

	
	public void setVersionType(String versionType) {
		this.versionType = versionType;
		if (!StringUtils.isEmpty(versionType)) {
			RedisCache<String, String> redisCache = (RedisCache<String, String>) SpringContextUtil.getBean("redisCache");
			String redisValue =  redisCache.getStr(RedisKeyPrefix.DIC_PREFIX+versionType);
			if (!StringUtils.isEmpty(redisValue)) {
				this.versionTypeName = redisValue;
			}
		}
	}

	
	public String getAppId() {
		return appId;
	}

	
	public void setAppId(String appId) {
		this.appId = appId;
	}
	
	
	public String getVersionStatusName() {
		return versionStatusName;
	}

	
	public void setVersionStatusName(String versionStatusName) {
		this.versionStatusName = versionStatusName;
	}

	public Long getTimeStamp() {
		return timeStamp;
	}

	
	public void setTimeStamp(Long timeStamp) {
		this.timeStamp = timeStamp;
	}
	
	public String getParam() {
		return param;
	}
	
	public void setParam(String param) {
		this.param = param;
	}
	
	public String getVersionCode() {
		return versionCode;
	}

	
	public void setVersionCode(String versionCode) {
		this.versionCode = versionCode;
	}

	public String toString() {
		return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
			.append("Id",getId())
			.append("VersionNo",getVersionNo())
			.append("VersionContent",getVersionContent())
			.append("VersionUrl",getVersionUrl())
			.append("IsCoercion",getCoercionIs())
			.append("VersionStatus",getVersionStatus())
			.append("Creater",getCreater())
			.append("GmtCreate",getGmtCreate())
			.append("Modifier",getModifier())
			.append("GmtModified",getGmtModified())
			.toString();
	}
	
	public int hashCode() {
		return new HashCodeBuilder()
			.append(getId())
			.toHashCode();
	}
	
	public boolean equals(Object obj) {
		if(obj instanceof AppVersionDTO == false){return false;}
		if(this == obj){return true;}
		AppVersionDTO other = (AppVersionDTO)obj;
		return new EqualsBuilder()
			.append(getId(),other.getId())
			.isEquals();
	}
}

